package com.junmeng.jdemo.recycler.chat.databinding;

import androidx.databinding.ViewDataBinding;

import com.example.common.recycler.databinding.BaseDataBindingBindView;
import com.example.common.recycler.databinding.DataBindingViewHolder;
import com.junmeng.jdemo.R;
import com.junmeng.jdemo.databinding.ItemChatDatabindingImageReceiveBinding;
import com.junmeng.jdemo.databinding.ItemChatDatabindingImageSendBinding;
import com.junmeng.jdemo.recycler.chat.IKind;

public class BindViewImage extends BaseDataBindingBindView<BindViewImage.Item, ViewDataBinding> {

    @Override
    public int getItemLayoutResId(Item item) {
        int layoutResId;
        if (item.getKind() == 0) {
            layoutResId = R.layout.item_chat_databinding_image_receive;
        } else {
            layoutResId = R.layout.item_chat_databinding_image_send;
        }
        return layoutResId;
    }

    @Override
    public void bindViewDataWithFull(DataBindingViewHolder holder, int position, Item item) {
        if (item.getKind() == 0) {
            ItemChatDatabindingImageReceiveBinding viewholder = (ItemChatDatabindingImageReceiveBinding) holder.mBinding;
        } else {
            ItemChatDatabindingImageSendBinding viewholder = (ItemChatDatabindingImageSendBinding) holder.mBinding;
        }
    }

    public static class Item implements IKind {

        public Item(int kind) {
            this.kind = kind;
        }

        public Item(int kind, String text) {
            this.kind = kind;
            this.text = text;
        }

        int kind;

        public String text;

        @Override
        public void setKind(int kind) {
            this.kind = kind;
        }

        @Override
        public int getKind() {
            return kind;
        }
    }

}
